home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / Miscellaneous / C⁄C++ Source Code Formatter / cdent example next >
Encoding:
Text File  |  1998-11-25  |  986 b   |  31 lines  |  [TEXT/MPS ]

  1.  
  2. # Create a variable that evaluates to the desired format string for cdent.
  3.  
  4.     SET MyCPlusFormat ∂
  5.         '-ll 512 ∂
  6.         -decl0 "&n dl0" ∂
  7.         -fundef4 "• &n" ∂
  8.         -fundef8 "i+®0 s • &n" ∂
  9.         -fundef10 "?n∂{• s#}∂{•/?n∂{s#}∂{&n c®2}}" ∂
  10.         -fundef13 "&n c®2-®0 • n" ∂
  11.         -fundef14 "&n c®2-®0 • n" ∂
  12.         -if4 "&n • &n i+®0" ∂
  13.         -if6 "&n c®2-®0 &n • &n" ∂
  14.         -else3 "&n • &n • i+®0" ∂
  15.         -struct3 "&n• n# i+®0" ∂
  16.         -switch2 "&n • n# i+®0 i+®0" ∂
  17.         -switch3 "&n c®2-®0 • &s" ∂
  18.         -switch7 "i-®0 c®2-®0 &n • n#" ∂
  19.         -while2 "&n • n# i+®0" ∂
  20.         -for5 "&n • n# i+®0" ∂
  21.         -do2 "&n • n# i+®0"'
  22.     EXPORT MyCPlusFormat
  23.  
  24.  
  25. # Set up a menu item/command key that will format C++ code according to your conventions.
  26. # You can then format an entire open window or a "proper" selection (i.e. a whole function,
  27. # or other outer level declaration).
  28.  
  29. AddMenu edit 'CDent §/=' '(CDent {MyCPlusFormat} ∂
  30.     <"{active}.§" >"{MPW}cdentText" ≥ "{MPW}MPW.Errors" && catenate "{MPW}cdentText">"{active}.§") || alert <"{MPW}MPW.Errors"'
  31.